<html>
<head>
<title>File Source for functions.php</title>
<link rel="stylesheet" type="text/css" href="../media/style.css">
</head>
<body>

<table border="0" cellspacing="0" cellpadding="0" height="48" width="100%">
  <tr>
    <td class="header_top">smt2</td>
  </tr>
  <tr><td class="header_line"><img src="../media/empty.png" width="1" height="1" border="0" alt=""  /></td></tr>
  <tr>
    <td class="header_menu">
        
                                    
                                                                      		  [ <a href="../classtrees_smt2.html" class="menu">class tree: smt2</a> ]
		  [ <a href="../elementindex_smt2.html" class="menu">index: smt2</a> ]
		  	    [ <a href="../elementindex.html" class="menu">all elements</a> ]
    </td>
  </tr>
  <tr><td class="header_line"><img src="../media/empty.png" width="1" height="1" border="0" alt=""  /></td></tr>
</table>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="200" class="menu">
      <b>Packages:</b><br />
              <a href="../li_smt2.html">smt2</a><br />
              <a href="../li_PegasusPHP.html">PegasusPHP</a><br />
              <a href="../li_PHPMailer.html">PHPMailer</a><br />
            <br /><br />
                  
      
                </td>
    <td>
      <table cellpadding="10" cellspacing="0" width="100%" border="0"><tr><td valign="top">

<h1 align="center">Source for file functions.php</h1>
<p>Documentation is available at <a href="../smt2/_functions.php.html">functions.php</a></p>
<div class="src-code">
<ol><li><div class="src-line"><a name="a1"></a><span class="src-php">&lt;?php</span></div></li>
<li><div class="src-line"><a name="a2"></a><span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a3"></a><span class="src-doc">&nbsp;*&nbsp;smt2&nbsp;CMS&nbsp;core&nbsp;functions.</span></div></li>
<li><div class="src-line"><a name="a4"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-tag">@date</span><span class="src-doc">&nbsp;27/March/2009</span></div></li>
<li><div class="src-line"><a name="a5"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-tag">@rev</span><span class="src-doc">&nbsp;20/December/2009</span></div></li>
<li><div class="src-line"><a name="a6"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a7"></a><a href="http://www.php.net/error_reporting">error_reporting</a><span class="src-sym">(</span><span class="src-id">E_ALL&nbsp;</span>|&nbsp;<span class="src-id">E_STRICT</span><span class="src-sym">)</span><span class="src-sym">;&nbsp;</span><span class="src-comm">//&nbsp;uncomment&nbsp;for&nbsp;debugging</span></div></li>
<li><div class="src-line"><a name="a8"></a><a href="../smt2/_functions.php.html#functionunregister_GLOBALS">unregister_GLOBALS</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a9"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a10"></a><span class="src-comm">//&nbsp;ignore&nbsp;PHP&nbsp;strict&nbsp;notice&nbsp;if&nbsp;time&nbsp;zone&nbsp;has&nbsp;not&nbsp;been&nbsp;set&nbsp;in&nbsp;php.ini</span></div></li>
<li><div class="src-line"><a name="a11"></a><span class="src-var">$defaultTimeZone&nbsp;</span>=&nbsp;<span class="src-sym">@</span><a href="http://www.php.net/date_default_timezone_get">date_default_timezone_get</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a12"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a13"></a><span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$defaultTimeZone</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a14"></a>&nbsp;&nbsp;<span class="src-var">$location&nbsp;</span>=&nbsp;<span class="src-var">$defaultTimeZone</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a15"></a><span class="src-sym">}&nbsp;</span><span class="src-key">else&nbsp;</span><span class="src-key">if&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/ini_get">ini_get</a><span class="src-sym">(</span><span class="src-str">'date.timezone'</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a16"></a>&nbsp;&nbsp;<span class="src-var">$location&nbsp;</span>=&nbsp;<a href="http://www.php.net/ini_get">ini_get</a><span class="src-sym">(</span><span class="src-str">'date.timezone'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a17"></a><span class="src-sym">}&nbsp;</span><span class="src-key">else&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a18"></a>&nbsp;&nbsp;<span class="src-var">$location&nbsp;</span>=&nbsp;<span class="src-str">'UTC'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a19"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a20"></a><span class="src-comm">//&nbsp;set&nbsp;date</span></div></li>
<li><div class="src-line"><a name="a21"></a><a href="http://www.php.net/date_default_timezone_set">date_default_timezone_set</a><span class="src-sym">(</span><span class="src-var">$location</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a22"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a23"></a><span class="src-comm">//&nbsp;load&nbsp;base&nbsp;files</span></div></li>
<li><div class="src-line"><a name="a24"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'REQUIRED'</span><span class="src-sym">,&nbsp;</span><span class="src-id">dirname</span><span class="src-sym">(</span>__FILE__<span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a25"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a26"></a><span class="src-comm">//&nbsp;----------------------------------------------------------&nbsp;smt2&nbsp;constants&nbsp;---</span></div></li>
<li><div class="src-line"><a name="a27"></a>require&nbsp;<span class="src-id">REQUIRED</span>.<span class="src-str">'/define.php'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a28"></a>require&nbsp;<span class="src-id">REQUIRED</span>.<span class="src-str">'/messages.php'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a29"></a><span class="src-comm">//&nbsp;---------------------------------------------------------------&nbsp;utilities&nbsp;---</span></div></li>
<li><div class="src-line"><a name="a30"></a>require&nbsp;<span class="src-id">REQUIRED</span>.<span class="src-str">'/class.domutil.php'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a31"></a>require&nbsp;<span class="src-id">REQUIRED</span>.<span class="src-str">'/class.browser.php'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a32"></a>require&nbsp;<span class="src-id">REQUIRED</span>.<span class="src-str">'/class.point.php'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a33"></a><span class="src-comm">//&nbsp;------------------------------------------------------------&nbsp;database&nbsp;API&nbsp;---</span></div></li>
<li><div class="src-line"><a name="a34"></a>require&nbsp;<span class="src-id">REQUIRED</span>.<span class="src-str">'/functions.db.php'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a35"></a><span class="src-comm">//&nbsp;------------------------------------------------------------------&nbsp;others&nbsp;---</span></div></li>
<li><div class="src-line"><a name="a36"></a>require&nbsp;<span class="src-id">REQUIRED</span>.<span class="src-str">'/functions.array.php'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a37"></a>require&nbsp;<span class="src-id">REQUIRED</span>.<span class="src-str">'/functions.url.php'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a38"></a><span class="src-inc">require_once&nbsp;</span><span class="src-id">realpath</span><span class="src-sym">(</span><span class="src-id">REQUIRED</span>.<span class="src-str">'../../../'</span><span class="src-sym">)</span>.<span class="src-str">'/core/functions.php'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a39"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a40"></a><span class="src-doc">/**&nbsp;</span></div></li>
<li><div class="src-line"><a name="a41"></a><span class="src-doc">&nbsp;*&nbsp;Additional&nbsp;head&nbsp;tags.&nbsp;Enable&nbsp;inserting&nbsp;custom&nbsp;tags&nbsp;on&nbsp;page&nbsp;head.</span></div></li>
<li><div class="src-line"><a name="a42"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@global&nbsp;</span><span class="src-doc-type">array&nbsp;</span><span class="src-doc-var">$_headAdded&nbsp;</span></div></li>
<li><div class="src-line"><a name="a43"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a44"></a><span class="src-var">$_headAdded&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a45"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a46"></a><span class="src-doc">/**&nbsp;</span></div></li>
<li><div class="src-line"><a name="a47"></a><span class="src-doc">&nbsp;*&nbsp;Checks&nbsp;if&nbsp;server&nbsp;is&nbsp;ready&nbsp;to&nbsp;work&nbsp;with&nbsp;smt2&nbsp;by&nbsp;comparing&nbsp;the&nbsp;server's&nbsp;$type&nbsp;version.</span></div></li>
<li><div class="src-line"><a name="a48"></a><span class="src-doc">&nbsp;*&nbsp;At&nbsp;least&nbsp;are&nbsp;required&nbsp;both&nbsp;PHP&nbsp;5&nbsp;and&nbsp;MySQL&nbsp;5.</span></div></li>
<li><div class="src-line"><a name="a49"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc">&nbsp;&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;</span><span class="src-doc-var">$type&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;php&quot;&nbsp;or&nbsp;&quot;mysql&quot;,&nbsp;by&nbsp;now</span></div></li>
<li><div class="src-line"><a name="a50"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc">&nbsp;&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;</span><span class="src-doc-var">$minReqVer&nbsp;</span><span class="src-doc">&nbsp;minimun&nbsp;system&nbsp;version&nbsp;(default:&nbsp;5.0.0)</span></div></li>
<li><div class="src-line"><a name="a51"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-type">boolean&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TRUE&nbsp;on&nbsp;sucess,&nbsp;or&nbsp;FALSE&nbsp;on&nbsp;failure</span></div></li>
<li><div class="src-line"><a name="a52"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a53"></a><span class="src-key">function&nbsp;</span><a href="../smt2/_functions.php.html#functioncheck_systemversion">check_systemversion</a><span class="src-sym">(</span><span class="src-var">$type</span><span class="src-sym">,&nbsp;</span><span class="src-var">$minReqVer&nbsp;</span>=&nbsp;<span class="src-str">&quot;5.0.0&quot;</span><span class="src-sym">)&nbsp;</span></div></li>
<li><div class="src-line"><a name="a54"></a><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a55"></a>&nbsp;&nbsp;<span class="src-key">switch&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/strtolower">strtolower</a><span class="src-sym">(</span><span class="src-var">$type</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a56"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'mysql'</span>:</div></li>
<li><div class="src-line"><a name="a57"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$ver&nbsp;</span>=&nbsp;<a href="http://www.php.net/mysql_get_server_info">mysql_get_server_info</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a58"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a59"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'php'</span>:</div></li>
<li><div class="src-line"><a name="a60"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$ver&nbsp;</span>=&nbsp;<a href="http://www.php.net/phpversion">phpversion</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a61"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a62"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">default</span>:</div></li>
<li><div class="src-line"><a name="a63"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a64"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a65"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;$ver&nbsp;must&nbsp;be&nbsp;&gt;=&nbsp;$minReqVer</span></div></li>
<li><div class="src-line"><a name="a66"></a>&nbsp;&nbsp;<span class="src-var">$status&nbsp;</span>=&nbsp;<a href="http://www.php.net/version_compare">version_compare</a><span class="src-sym">(</span><span class="src-var">$ver</span><span class="src-sym">,&nbsp;</span><span class="src-var">$minReqVer</span><span class="src-sym">,&nbsp;</span><span class="src-str">&quot;&gt;=&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a67"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a68"></a>&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$status</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a69"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a70"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a71"></a><span class="src-doc">/**&nbsp;</span></div></li>
<li><div class="src-line"><a name="a72"></a><span class="src-doc">&nbsp;*&nbsp;Checks&nbsp;if&nbsp;a&nbsp;new&nbsp;smt2&nbsp;version&nbsp;is&nbsp;released&nbsp;via&nbsp;(smt)&nbsp;website.</span></div></li>
<li><div class="src-line"><a name="a73"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-type">int&nbsp;</span><span class="src-doc">&nbsp;&nbsp;Server&nbsp;response:&nbsp;1&nbsp;(up&nbsp;to&nbsp;date),&nbsp;2&nbsp;(new&nbsp;version&nbsp;found),&nbsp;3&nbsp;(minor&nbsp;build&nbsp;released),&nbsp;0&nbsp;(connection&nbsp;error),&nbsp;-1&nbsp;(parsing&nbsp;error)</span></div></li>
<li><div class="src-line"><a name="a74"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a75"></a><span class="src-key">function&nbsp;</span><a href="../smt2/_functions.php.html#functionget_smt_releases">get_smt_releases</a><span class="src-sym">(</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a76"></a><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a77"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;connect&nbsp;to&nbsp;Web&nbsp;Service</span></div></li>
<li><div class="src-line"><a name="a78"></a>&nbsp;&nbsp;<span class="src-var">$ws&nbsp;</span>=&nbsp;<span class="src-id">get_remote_webpage</span><span class="src-sym">(</span><span class="src-str">&quot;http://smt.speedzinemedia.com/smt/versioncheck.php?v=&quot;</span>.<span class="src-id"><a href="../smt2/_define.php.html#defineSMT_VERSION">SMT_VERSION</a></span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a79"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a80"></a>&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$ws</span><span class="src-sym">[</span><span class="src-str">'content'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a81"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a82"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a83"></a><span class="src-doc">/**&nbsp;</span></div></li>
<li><div class="src-line"><a name="a84"></a><span class="src-doc">&nbsp;*&nbsp;Displays&nbsp;a&nbsp;message&nbsp;about&nbsp;the&nbsp;installed&nbsp;smt2&nbsp;version.</span></div></li>
<li><div class="src-line"><a name="a85"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc">&nbsp;&nbsp;Message</span></div></li>
<li><div class="src-line"><a name="a86"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a87"></a><span class="src-key">function&nbsp;</span><a href="../smt2/_functions.php.html#functioncheck_smt_releases">check_smt_releases</a><span class="src-sym">(</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a88"></a><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a89"></a>&nbsp;&nbsp;<span class="src-key">global&nbsp;</span><a href="../smt2/_messages.php.html#global$_displayType">$_displayType</a><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a90"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a91"></a>&nbsp;&nbsp;<span class="src-var">$dwnurl&nbsp;</span>=&nbsp;<span class="src-str">&quot;http://smt.speedzinemedia.com/smt/downloads.php&quot;</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a92"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a93"></a>&nbsp;&nbsp;<span class="src-var">$code&nbsp;</span>=&nbsp;<a href="../smt2/_functions.php.html#functionget_smt_releases">get_smt_releases</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a94"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a95"></a>&nbsp;&nbsp;<span class="src-key">switch&nbsp;</span><span class="src-sym">(</span><span class="src-var">$code</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a96"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span>-<span class="src-num">1</span>:&nbsp;&nbsp;<span class="src-comm">//&nbsp;parsing/reading&nbsp;error</span></div></li>
<li><div class="src-line"><a name="a97"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$type&nbsp;</span>=&nbsp;<span class="src-var">$_displayType</span><span class="src-sym">[</span><span class="src-str">&quot;ERROR&quot;</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a98"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$text&nbsp;</span>=&nbsp;<span class="src-str">'Error&nbsp;while&nbsp;retrieving&nbsp;new&nbsp;(smt)&lt;sup&gt;2&lt;/sup&gt;&nbsp;releases.'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a99"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a100"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-num">0</span>:&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;connection&nbsp;error</span></div></li>
<li><div class="src-line"><a name="a101"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">default</span>:</div></li>
<li><div class="src-line"><a name="a102"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$type&nbsp;</span>=&nbsp;<span class="src-var">$_displayType</span><span class="src-sym">[</span><span class="src-str">&quot;ERROR&quot;</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a103"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$text&nbsp;</span>=&nbsp;<span class="src-str">'Could&nbsp;not&nbsp;find&nbsp;new&nbsp;(smt)&lt;sup&gt;2&lt;/sup&gt;&nbsp;releases.&nbsp;If&nbsp;your&nbsp;Internet&nbsp;connection&nbsp;is&nbsp;OK,&nbsp;maybe&nbsp;the&nbsp;server&nbsp;is&nbsp;temporarily&nbsp;down.'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a104"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a105"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-num">1</span>:&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;up&nbsp;to&nbsp;date</span></div></li>
<li><div class="src-line"><a name="a106"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$type&nbsp;</span>=&nbsp;<span class="src-var">$_displayType</span><span class="src-sym">[</span><span class="src-str">&quot;SUCCESS&quot;</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a107"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$text&nbsp;</span>=&nbsp;<span class="src-str">'You&nbsp;are&nbsp;using&nbsp;the&nbsp;latest&nbsp;(smt)&lt;sup&gt;2&lt;/sup&gt;&nbsp;version:&nbsp;'</span>.<span class="src-id"><a href="../smt2/_define.php.html#defineSMT_VERSION">SMT_VERSION</a></span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a108"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a109"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-num">2</span>:&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;new&nbsp;version&nbsp;found</span></div></li>
<li><div class="src-line"><a name="a110"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$type&nbsp;</span>=&nbsp;<span class="src-var">$_displayType</span><span class="src-sym">[</span><span class="src-str">&quot;WARNING&quot;</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a111"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$text&nbsp;</span>=&nbsp;<span class="src-str">'A&nbsp;new&nbsp;(smt)&lt;sup&gt;2&lt;/sup&gt;&nbsp;version&nbsp;is&nbsp;available.&nbsp;&lt;a&nbsp;href=&quot;'</span>.<span class="src-var">$dwnurl</span>.<span class="src-str">'&quot;&gt;Please&nbsp;upgrade&lt;/a&gt;.'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a112"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a113"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-num">3</span>:&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;minor&nbsp;build&nbsp;released</span></div></li>
<li><div class="src-line"><a name="a114"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$type&nbsp;</span>=&nbsp;<span class="src-var">$_displayType</span><span class="src-sym">[</span><span class="src-str">&quot;WARNING&quot;</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a115"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$text&nbsp;</span>=&nbsp;<span class="src-str">'It&nbsp;seems&nbsp;that&nbsp;there&nbsp;is&nbsp;a&nbsp;&lt;a&nbsp;href=&quot;'</span>.<span class="src-var">$dwnurl</span>.<span class="src-str">'&quot;&gt;new&nbsp;(smt)&lt;sup&gt;2&lt;/sup&gt;&nbsp;build&nbsp;available&lt;/a&gt;.'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a116"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a117"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a118"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a119"></a>&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><a href="../smt2/_functions.php.html#functiondisplay_text">display_text</a><span class="src-sym">(</span><span class="src-var">$type</span><span class="src-sym">,&nbsp;</span><span class="src-var">$text</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a120"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a121"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a122"></a><span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a123"></a><span class="src-doc">&nbsp;*&nbsp;Displays&nbsp;a&nbsp;text&nbsp;paragraph&nbsp;on&nbsp;page.</span></div></li>
<li><div class="src-line"><a name="a124"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc">&nbsp;&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;</span><span class="src-doc-var">$type&nbsp;</span><span class="src-doc">&quot;warning&quot;,&nbsp;&quot;error&quot;&nbsp;or&nbsp;&quot;success&quot;</span></div></li>
<li><div class="src-line"><a name="a125"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc">&nbsp;&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;</span><span class="src-doc-var">$msg&nbsp;</span><span class="src-doc">&nbsp;message&nbsp;to&nbsp;display</span></div></li>
<li><div class="src-line"><a name="a126"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc">&nbsp;&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;</span><span class="src-doc-var">$elem&nbsp;</span><span class="src-doc">DOM&nbsp;element&nbsp;to&nbsp;enclose&nbsp;message&nbsp;(default:&nbsp;p)</span></div></li>
<li><div class="src-line"><a name="a127"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a128"></a><span class="src-key">function&nbsp;</span><a href="../smt2/_functions.php.html#functiondisplay_text">display_text</a><span class="src-sym">(</span><span class="src-var">$type</span><span class="src-sym">,&nbsp;</span><span class="src-var">$msg</span><span class="src-sym">,&nbsp;</span><span class="src-var">$elem&nbsp;</span>=&nbsp;<span class="src-str">'p'</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a129"></a><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a130"></a>&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-str">'&lt;'</span>.<span class="src-var">$elem</span>.<span class="src-str">'&nbsp;class=&quot;'</span>.<span class="src-var">$type</span>.<span class="src-str">'&quot;&gt;'</span>.<span class="src-var">$msg</span>.<span class="src-str">'&lt;/'</span>.<span class="src-var">$elem</span>.<span class="src-str">'&gt;'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a131"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a132"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a133"></a><span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a134"></a><span class="src-doc">&nbsp;*&nbsp;Redirects&nbsp;the&nbsp;browser&nbsp;to&nbsp;a&nbsp;specified&nbsp;anchor&nbsp;on&nbsp;the&nbsp;index.php&nbsp;page&nbsp;that&nbsp;sent&nbsp;a&nbsp;form&nbsp;from&nbsp;a&nbsp;CMS&nbsp;section.</span></div></li>
<li><div class="src-line"><a name="a135"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc">&nbsp;&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;</span><span class="src-doc-var">$id&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;HTML&nbsp;element&nbsp;id</span></div></li>
<li><div class="src-line"><a name="a136"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc">&nbsp;&nbsp;</span><span class="src-doc-type">boolean&nbsp;</span><span class="src-doc">&nbsp;&nbsp;</span><span class="src-doc-var">$success&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;no&nbsp;errors&nbsp;to&nbsp;display</span></div></li>
<li><div class="src-line"><a name="a137"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc">&nbsp;&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;</span><span class="src-doc-var">$customErr&nbsp;</span><span class="src-doc">&nbsp;if&nbsp;$success&nbsp;is&nbsp;false,&nbsp;type&nbsp;here&nbsp;your&nbsp;own&nbsp;custom&nbsp;message</span></div></li>
<li><div class="src-line"><a name="a138"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a139"></a><span class="src-key">function&nbsp;</span><a href="../smt2/_functions.php.html#functionnotify_request">notify_request</a><span class="src-sym">(</span><span class="src-var">$id</span><span class="src-sym">,&nbsp;</span><span class="src-var">$success</span><span class="src-sym">,&nbsp;</span><span class="src-var">$customErr&nbsp;</span>=&nbsp;<span class="src-str">&quot;&quot;</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a140"></a><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a141"></a>&nbsp;&nbsp;<span class="src-key">global&nbsp;</span><a href="../smt2/_messages.php.html#global$_displayType">$_displayType</a><span class="src-sym">,&nbsp;</span><a href="../smt2/_messages.php.html#global$_notifyMsg">$_notifyMsg</a><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a142"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a143"></a>&nbsp;&nbsp;<span class="src-var">$errorMessage&nbsp;</span>=&nbsp;<span class="src-var">$_notifyMsg</span><span class="src-sym">[</span><span class="src-str">&quot;ERROR&quot;</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a144"></a>&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$success&nbsp;</span>&amp;&amp;&nbsp;<span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$customErr</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a145"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$errorMessage&nbsp;</span>=&nbsp;<span class="src-var">$customErr</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a146"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a147"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a148"></a>&nbsp;&nbsp;<span class="src-var">$_SESSION</span><span class="src-sym">[&nbsp;</span><span class="src-var">$id&nbsp;</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-sym">(</span><span class="src-var">$success</span><span class="src-sym">)&nbsp;</span>?&nbsp;</div></li>
<li><div class="src-line"><a name="a149"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="../smt2/_functions.php.html#functiondisplay_text">display_text</a><span class="src-sym">(</span><span class="src-var">$_displayType</span><span class="src-sym">[</span><span class="src-str">&quot;SUCCESS&quot;</span><span class="src-sym">]</span><span class="src-sym">,&nbsp;</span><span class="src-var">$_notifyMsg</span><span class="src-sym">[</span><span class="src-str">&quot;SAVED&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a150"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</div></li>
<li><div class="src-line"><a name="a151"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="../smt2/_functions.php.html#functiondisplay_text">display_text</a><span class="src-sym">(</span><span class="src-var">$_displayType</span><span class="src-sym">[</span><span class="src-str">&quot;ERROR&quot;</span><span class="src-sym">]</span><span class="src-sym">,&nbsp;&nbsp;&nbsp;</span><span class="src-var">$errorMessage</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a152"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a153"></a>&nbsp;&nbsp;<a href="../smt2/_functions.url.php.html#functionurl_redirect">url_redirect</a><span class="src-sym">(&nbsp;</span><a href="http://www.php.net/dirname">dirname</a><span class="src-sym">(</span><span class="src-var">$_SERVER</span><span class="src-sym">[</span><span class="src-str">'SCRIPT_NAME'</span><span class="src-sym">]</span><span class="src-sym">)</span>.<span class="src-str">&quot;/#&quot;</span>.<span class="src-var">$id&nbsp;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a154"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a155"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a156"></a><span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a157"></a><span class="src-doc">&nbsp;*&nbsp;Displays&nbsp;the&nbsp;message&nbsp;saved&nbsp;on&nbsp;current&nbsp;PHP&nbsp;session.&nbsp;Then&nbsp;the&nbsp;$_SESSION&nbsp;text&nbsp;is&nbsp;unset.</span></div></li>
<li><div class="src-line"><a name="a158"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc">&nbsp;&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-var">$name&nbsp;</span><span class="src-doc">&nbsp;&nbsp;session&nbsp;variable&nbsp;name</span></div></li>
<li><div class="src-line"><a name="a159"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a160"></a><span class="src-key">function&nbsp;</span><a href="../smt2/_functions.php.html#functioncheck_notified_request">check_notified_request</a><span class="src-sym">(</span><span class="src-var">$name</span><span class="src-sym">)&nbsp;</span></div></li>
<li><div class="src-line"><a name="a161"></a><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a162"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;get&nbsp;$name&nbsp;text&nbsp;from&nbsp;session</span></div></li>
<li><div class="src-line"><a name="a163"></a>&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$_SESSION</span><span class="src-sym">[</span><span class="src-var">$name</span><span class="src-sym">]</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a164"></a>&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<span class="src-var">$_SESSION</span><span class="src-sym">[</span><span class="src-var">$name</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a165"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a166"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;unset&nbsp;session&nbsp;var</span></div></li>
<li><div class="src-line"><a name="a167"></a>&nbsp;&nbsp;unset<span class="src-sym">(</span><span class="src-var">$_SESSION</span><span class="src-sym">[</span><span class="src-var">$name</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a168"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a169"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a170"></a><span class="src-doc">/**&nbsp;</span></div></li>
<li><div class="src-line"><a name="a171"></a><span class="src-doc">&nbsp;*&nbsp;Shows&nbsp;only&nbsp;the&nbsp;first&nbsp;$words&nbsp;of&nbsp;a&nbsp;text,&nbsp;plus&nbsp;a&nbsp;[...]&nbsp;symbol.</span></div></li>
<li><div class="src-line"><a name="a172"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc">&nbsp;&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-var">$text&nbsp;</span><span class="src-doc">&nbsp;&nbsp;text&nbsp;to&nbsp;trim</span></div></li>
<li><div class="src-line"><a name="a173"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc">&nbsp;&nbsp;</span><span class="src-doc-type">int&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-doc-var">$words&nbsp;</span><span class="src-doc">&nbsp;number&nbsp;of&nbsp;words&nbsp;to&nbsp;display&nbsp;(default:&nbsp;5)</span></div></li>
<li><div class="src-line"><a name="a174"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;trimmed&nbsp;text</span></div></li>
<li><div class="src-line"><a name="a175"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a176"></a><span class="src-key">function&nbsp;</span><a href="../smt2/_functions.php.html#functiontrim_text">trim_text</a><span class="src-sym">(</span><span class="src-var">$text</span><span class="src-sym">,&nbsp;</span><span class="src-var">$words&nbsp;</span>=&nbsp;<span class="src-num">5</span><span class="src-sym">)&nbsp;</span></div></li>
<li><div class="src-line"><a name="a177"></a><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a178"></a>&nbsp;&nbsp;<span class="src-var">$space&nbsp;</span>=&nbsp;<span class="src-str">&quot;&nbsp;&quot;</span><span class="src-sym">;&nbsp;&nbsp;</span></div></li>
<li><div class="src-line"><a name="a179"></a>&nbsp;&nbsp;<span class="src-var">$text&nbsp;</span>=&nbsp;<a href="http://www.php.net/explode">explode</a><span class="src-sym">(</span><span class="src-var">$space</span><span class="src-sym">,&nbsp;</span><span class="src-var">$text</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a180"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a181"></a>&nbsp;&nbsp;<span class="src-var">$show&nbsp;</span>=&nbsp;<span class="src-str">&quot;&quot;</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a182"></a>&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$text&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$i&nbsp;</span>=&gt;&nbsp;<span class="src-var">$str</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a183"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$i&nbsp;</span>&lt;&nbsp;<span class="src-var">$words</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{&nbsp;</span></div></li>
<li><div class="src-line"><a name="a184"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$show&nbsp;</span>.=&nbsp;<span class="src-var">$str</span>.<span class="src-var">$space</span><span class="src-sym">;&nbsp;</span></div></li>
<li><div class="src-line"><a name="a185"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a186"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a187"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;references&nbsp;of&nbsp;$i&nbsp;and&nbsp;the&nbsp;last&nbsp;array&nbsp;element&nbsp;remain&nbsp;</span></div></li>
<li><div class="src-line"><a name="a188"></a>&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$i&nbsp;</span>&gt;=&nbsp;<span class="src-var">$words</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a189"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;add&nbsp;[...]&nbsp;if&nbsp;word&nbsp;count&nbsp;is&nbsp;indeed&nbsp;larger&nbsp;than&nbsp;$words</span></div></li>
<li><div class="src-line"><a name="a190"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$show&nbsp;</span>.=&nbsp;<span class="src-var">$space</span>.<span class="src-str">&quot;[...]&quot;</span><span class="src-sym">;&nbsp;</span></div></li>
<li><div class="src-line"><a name="a191"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a192"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a193"></a>&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$show</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a194"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a195"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a196"></a><span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a197"></a><span class="src-doc">&nbsp;*&nbsp;Gets&nbsp;the&nbsp;client&nbsp;IP.</span></div></li>
<li><div class="src-line"><a name="a198"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-type">string&nbsp;</span></div></li>
<li><div class="src-line"><a name="a199"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a200"></a><span class="src-key">function&nbsp;</span><a href="../smt2/_functions.php.html#functionget_ip">get_ip</a><span class="src-sym">(</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a201"></a><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a202"></a>&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(&nbsp;</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$_SERVER</span><span class="src-sym">[</span><span class="src-str">'HTTP_X_FORWARDED_FOR'</span><span class="src-sym">]</span><span class="src-sym">)&nbsp;)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a203"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$final_ip&nbsp;</span>=</div></li>
<li><div class="src-line"><a name="a204"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">(&nbsp;</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$_SERVER</span><span class="src-sym">[</span><span class="src-str">'REMOTE_ADDR'</span><span class="src-sym">]</span><span class="src-sym">)&nbsp;)&nbsp;</span>?</div></li>
<li><div class="src-line"><a name="a205"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$_SERVER</span><span class="src-sym">[</span><span class="src-str">'REMOTE_ADDR'</span><span class="src-sym">]&nbsp;</span>:</div></li>
<li><div class="src-line"><a name="a206"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">(&nbsp;(&nbsp;</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$_ENV</span><span class="src-sym">[</span><span class="src-str">'REMOTE_ADDR'</span><span class="src-sym">]</span><span class="src-sym">)&nbsp;)&nbsp;</span>?</div></li>
<li><div class="src-line"><a name="a207"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$_ENV</span><span class="src-sym">[</span><span class="src-str">'REMOTE_ADDR'</span><span class="src-sym">]&nbsp;</span>:</div></li>
<li><div class="src-line"><a name="a208"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-str">&quot;unknown&quot;&nbsp;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a209"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$entries&nbsp;</span>=&nbsp;<a href="http://www.php.net/split">split</a><span class="src-sym">(</span><span class="src-str">'[,&nbsp;]'</span><span class="src-sym">,&nbsp;</span><span class="src-var">$_SERVER</span><span class="src-sym">[</span><span class="src-str">'HTTP_X_FORWARDED_FOR'</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a210"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/reset">reset</a><span class="src-sym">(</span><span class="src-var">$entries</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a211"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">while&nbsp;</span><span class="src-sym">(</span>list<span class="src-sym">(</span><span class="src-sym">,&nbsp;</span><span class="src-var">$entry</span><span class="src-sym">)&nbsp;</span>=&nbsp;<a href="http://www.php.net/each">each</a><span class="src-sym">(</span><span class="src-var">$entries</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a212"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$entry&nbsp;</span>=&nbsp;<a href="http://www.php.net/trim">trim</a><span class="src-sym">(</span><span class="src-var">$entry</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a213"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(&nbsp;</span><a href="http://www.php.net/preg_match">preg_match</a><span class="src-sym">(</span><span class="src-str">&quot;/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-var">$entry</span><span class="src-sym">,&nbsp;</span><span class="src-var">$ip_list</span><span class="src-sym">)&nbsp;)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a214"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;see&nbsp;http://www.faqs.org/rfcs/rfc1918.html</span></div></li>
<li><div class="src-line"><a name="a215"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$private_ip&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span></div></li>
<li><div class="src-line"><a name="a216"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-str">'/^0\./'</span><span class="src-sym">,</span></div></li>
<li><div class="src-line"><a name="a217"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-str">'/^127\.0\.0\.1/'</span><span class="src-sym">,</span></div></li>
<li><div class="src-line"><a name="a218"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-str">'/^192\.168\..*/'</span><span class="src-sym">,</span></div></li>
<li><div class="src-line"><a name="a219"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-str">'/^172\.((1[6-9])|(2[0-9])|(3[0-1]))\..*/'</span><span class="src-sym">,</span></div></li>
<li><div class="src-line"><a name="a220"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-str">'/^10\..*/'</span></div></li>
<li><div class="src-line"><a name="a221"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a222"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a223"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$found_ip&nbsp;</span>=&nbsp;<a href="http://www.php.net/preg_replace">preg_replace</a><span class="src-sym">(</span><span class="src-var">$private_ip</span><span class="src-sym">,&nbsp;</span><span class="src-var">$final_ip</span><span class="src-sym">,&nbsp;</span><span class="src-var">$ip_list</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a224"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a225"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$final_ip&nbsp;</span>!=&nbsp;<span class="src-var">$found_ip</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a226"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$final_ip&nbsp;</span>=&nbsp;<span class="src-var">$found_ip</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a227"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a228"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a229"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a230"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a231"></a>&nbsp;&nbsp;&nbsp;<span class="src-sym">}&nbsp;</span><span class="src-key">else&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a232"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$final_ip&nbsp;</span>=</div></li>
<li><div class="src-line"><a name="a233"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">(&nbsp;</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$_SERVER</span><span class="src-sym">[</span><span class="src-str">'REMOTE_ADDR'</span><span class="src-sym">]</span><span class="src-sym">)&nbsp;)&nbsp;</span>?</div></li>
<li><div class="src-line"><a name="a234"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$_SERVER</span><span class="src-sym">[</span><span class="src-str">'REMOTE_ADDR'</span><span class="src-sym">]&nbsp;</span>:</div></li>
<li><div class="src-line"><a name="a235"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">(&nbsp;(&nbsp;</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$_ENV</span><span class="src-sym">[</span><span class="src-str">'REMOTE_ADDR'</span><span class="src-sym">]</span><span class="src-sym">)&nbsp;)&nbsp;</span>?</div></li>
<li><div class="src-line"><a name="a236"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$_ENV</span><span class="src-sym">[</span><span class="src-str">'REMOTE_ADDR'</span><span class="src-sym">]&nbsp;</span>:</div></li>
<li><div class="src-line"><a name="a237"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-str">&quot;unknown&quot;&nbsp;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a238"></a>&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a239"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a240"></a>&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$final_ip</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a241"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a242"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a243"></a><span class="src-doc">/**&nbsp;</span></div></li>
<li><div class="src-line"><a name="a244"></a><span class="src-doc">&nbsp;*&nbsp;Masks&nbsp;a&nbsp;given&nbsp;client&nbsp;ID&nbsp;string,&nbsp;just&nbsp;for&nbsp;pretty&nbsp;reading.</span></div></li>
<li><div class="src-line"><a name="a245"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc">&nbsp;&nbsp;</span><span class="src-doc-var">$hash&nbsp;</span><span class="src-doc">&nbsp;&nbsp;client&nbsp;ID</span></div></li>
<li><div class="src-line"><a name="a246"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Pretty-formatted&nbsp;client&nbsp;ID</span></div></li>
<li><div class="src-line"><a name="a247"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a248"></a><span class="src-key">function&nbsp;</span><a href="../smt2/_functions.php.html#functionmask_client">mask_client</a><span class="src-sym">(</span><span class="src-var">$hash</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a249"></a><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a250"></a>&nbsp;&nbsp;<span class="src-var">$half&nbsp;</span>=&nbsp;<a href="http://www.php.net/strlen">strlen</a><span class="src-sym">(</span><span class="src-var">$hash</span><span class="src-sym">)&nbsp;</span>/&nbsp;<span class="src-num">2</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a251"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a252"></a>&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$hash</span><span class="src-sym">,&nbsp;</span>-<span class="src-var">$half</span><span class="src-sym">,&nbsp;</span><span class="src-var">$half</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a253"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a254"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a255"></a><span class="src-doc">/**&nbsp;</span></div></li>
<li><div class="src-line"><a name="a256"></a><span class="src-doc">&nbsp;*&nbsp;Displays&nbsp;a&nbsp;default&nbsp;error&nbsp;page.</span></div></li>
<li><div class="src-line"><a name="a257"></a><span class="src-doc">&nbsp;*&nbsp;Used&nbsp;when&nbsp;a&nbsp;cached&nbsp;page&nbsp;is&nbsp;deleted,&nbsp;as&nbsp;well&nbsp;as&nbsp;when&nbsp;cURL&nbsp;cannot&nbsp;fetch&nbsp;a&nbsp;remote&nbsp;page.</span></div></li>
<li><div class="src-line"><a name="a258"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc">&nbsp;&nbsp;</span><span class="src-doc-var">$bodyText&nbsp;</span><span class="src-doc">additional&nbsp;info&nbsp;to&nbsp;display&nbsp;on&nbsp;page&nbsp;body</span></div></li>
<li><div class="src-line"><a name="a259"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;error&nbsp;page</span></div></li>
<li><div class="src-line"><a name="a260"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a261"></a><span class="src-key">function&nbsp;</span><a href="../smt2/_functions.php.html#functionerror_webpage">error_webpage</a><span class="src-sym">(</span><span class="src-var">$bodyText&nbsp;</span>=&nbsp;<span class="src-str">&quot;&quot;</span><span class="src-sym">)&nbsp;</span></div></li>
<li><div class="src-line"><a name="a262"></a><span class="src-sym">{&nbsp;&nbsp;</span></div></li>
<li><div class="src-line"><a name="a263"></a>&nbsp;&nbsp;<span class="src-var">$webpage&nbsp;</span>=&nbsp;<span class="src-str">'&lt;html&gt;&lt;head&gt;&lt;title&gt;Error&lt;/title&gt;&lt;/head&gt;&lt;body&gt;'</span>.<span class="src-var">$bodyText</span>.<span class="src-str">'&lt;/body&gt;&lt;/html&gt;'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a264"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a265"></a>&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$webpage</span><span class="src-sym">;&nbsp;</span></div></li>
<li><div class="src-line"><a name="a266"></a><span class="src-sym">}&nbsp;</span></div></li>
<li><div class="src-line"><a name="a267"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a268"></a><span class="src-doc">/**&nbsp;</span></div></li>
<li><div class="src-line"><a name="a269"></a><span class="src-doc">&nbsp;*&nbsp;Merges&nbsp;vertical&nbsp;and&nbsp;horizontal&nbsp;coordinates&nbsp;in&nbsp;a&nbsp;bidimensional&nbsp;point&nbsp;array.</span></div></li>
<li><div class="src-line"><a name="a270"></a><span class="src-doc">&nbsp;*&nbsp;Stops&nbsp;coordinates&nbsp;(hesitations)&nbsp;are&nbsp;removed.</span></div></li>
<li><div class="src-line"><a name="a271"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc">&nbsp;&nbsp;</span><span class="src-doc-type">array&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-var">$xcoords&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;horizontal&nbsp;coordinates</span></div></li>
<li><div class="src-line"><a name="a272"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc">&nbsp;&nbsp;</span><span class="src-doc-type">array&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-var">$ycoords&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;vertical&nbsp;coordinates</span></div></li>
<li><div class="src-line"><a name="a273"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc">&nbsp;&nbsp;</span><span class="src-doc-type">array&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-var">$getDistances&nbsp;</span><span class="src-doc">&nbsp;&nbsp;if&nbsp;TRUE,&nbsp;the&nbsp;result&nbsp;array&nbsp;contains&nbsp;euclidean&nbsp;distances</span></div></li>
<li><div class="src-line"><a name="a274"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-type">array&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2D&nbsp;points&nbsp;or&nbsp;euclidean&nbsp;distances&nbsp;array</span></div></li>
<li><div class="src-line"><a name="a275"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a276"></a><span class="src-key">function&nbsp;</span><a href="../smt2/_functions.php.html#functionconvert_points">convert_points</a><span class="src-sym">(</span><span class="src-var">$xcoords</span><span class="src-sym">,&nbsp;</span><span class="src-var">$ycoords</span><span class="src-sym">,&nbsp;</span><span class="src-var">$getDistances&nbsp;</span>=&nbsp;<span class="src-id">false</span><span class="src-sym">)&nbsp;</span></div></li>
<li><div class="src-line"><a name="a277"></a><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a278"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;initialize&nbsp;points&nbsp;array</span></div></li>
<li><div class="src-line"><a name="a279"></a>&nbsp;&nbsp;<span class="src-var">$pointArray&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a280"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;check&nbsp;for&nbsp;illegal&nbsp;offsets&nbsp;on&nbsp;$coords</span></div></li>
<li><div class="src-line"><a name="a281"></a>&nbsp;&nbsp;<span class="src-var">$maxCount&nbsp;</span>=&nbsp;<a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$xcoords</span><span class="src-sym">)&nbsp;</span>-&nbsp;<span class="src-num">1</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a282"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;transform&nbsp;arrays&nbsp;in&nbsp;a&nbsp;single&nbsp;points&nbsp;array</span></div></li>
<li><div class="src-line"><a name="a283"></a>&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$xcoords&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$i&nbsp;</span>=&gt;&nbsp;<span class="src-var">$value</span><span class="src-sym">)&nbsp;</span></div></li>
<li><div class="src-line"><a name="a284"></a>&nbsp;&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a285"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$p&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../smt2/Point.html">Point</a></span><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">,&nbsp;</span><span class="src-var">$ycoords</span><span class="src-sym">[</span><span class="src-var">$i</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;&nbsp;</span></div></li>
<li><div class="src-line"><a name="a286"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;check&nbsp;if&nbsp;next&nbsp;point&nbsp;exists&nbsp;</span></div></li>
<li><div class="src-line"><a name="a287"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$i&nbsp;</span>&gt;=&nbsp;<span class="src-var">$maxCount</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{&nbsp;</span><span class="src-key">break</span><span class="src-sym">;&nbsp;</span><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a288"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;ok</span></div></li>
<li><div class="src-line"><a name="a289"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$q&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../smt2/Point.html">Point</a></span><span class="src-sym">(</span><span class="src-var">$xcoords</span><span class="src-sym">[</span><span class="src-var">$i&nbsp;</span>+&nbsp;<span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">,&nbsp;</span><span class="src-var">$ycoords</span><span class="src-sym">[</span><span class="src-var">$i&nbsp;</span>+&nbsp;<span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a290"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$distance&nbsp;</span>=&nbsp;<span class="src-var">$p</span><span class="src-sym">-&gt;</span><span class="src-id">getDistance</span><span class="src-sym">(</span><span class="src-var">$q</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a291"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;check</span></div></li>
<li><div class="src-line"><a name="a292"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$getDistances</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a293"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$pointArray</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$distance</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a294"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}&nbsp;</span><span class="src-key">else&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a295"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;append&nbsp;point&nbsp;to&nbsp;the&nbsp;points&nbsp;array,&nbsp;discarding&nbsp;null&nbsp;distances</span></div></li>
<li><div class="src-line"><a name="a296"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$distance&nbsp;</span>&gt;&nbsp;<span class="src-num">0</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{&nbsp;</span><span class="src-var">$pointArray</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$p</span><span class="src-sym">;&nbsp;</span><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a297"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a298"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a299"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a300"></a>&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$pointArray</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a301"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a302"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a303"></a><span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a304"></a><span class="src-doc">&nbsp;*&nbsp;Counts&nbsp;the&nbsp;number&nbsp;of&nbsp;mouse&nbsp;clicks.</span></div></li>
<li><div class="src-line"><a name="a305"></a><span class="src-doc">&nbsp;*&nbsp;Drag&nbsp;and&nbsp;drop&nbsp;traces&nbsp;are&nbsp;removed.</span></div></li>
<li><div class="src-line"><a name="a306"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc">&nbsp;&nbsp;</span><span class="src-doc-type">array&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-var">$xclicks&nbsp;</span><span class="src-doc">&nbsp;&nbsp;horizontal&nbsp;click&nbsp;coordinates</span></div></li>
<li><div class="src-line"><a name="a307"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc">&nbsp;&nbsp;</span><span class="src-doc-type">array&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-var">$yclicks&nbsp;</span><span class="src-doc">&nbsp;&nbsp;vertical&nbsp;click&nbsp;coordinates</span></div></li>
<li><div class="src-line"><a name="a308"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-type">int&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;number&nbsp;of&nbsp;clicks</span></div></li>
<li><div class="src-line"><a name="a309"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a310"></a><span class="src-key">function&nbsp;</span><a href="../smt2/_functions.php.html#functioncount_clicks">count_clicks</a><span class="src-sym">(</span><span class="src-var">$xclicks</span><span class="src-sym">,&nbsp;</span><span class="src-var">$yclicks</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a311"></a><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a312"></a>&nbsp;&nbsp;<span class="src-var">$numClicks&nbsp;</span>=&nbsp;<span class="src-num">0</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a313"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a314"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;check</span></div></li>
<li><div class="src-line"><a name="a315"></a>&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$xclicks</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{&nbsp;</span><span class="src-var">$xclicks&nbsp;</span>=&nbsp;<a href="../smt2/_functions.array.php.html#functionarray_null">array_null</a><span class="src-sym">(</span><span class="src-var">$xclicks</span><span class="src-sym">)</span><span class="src-sym">;&nbsp;</span><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a316"></a>&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$yclicks</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{&nbsp;</span><span class="src-var">$yclicks&nbsp;</span>=&nbsp;<a href="../smt2/_functions.array.php.html#functionarray_null">array_null</a><span class="src-sym">(</span><span class="src-var">$yclicks</span><span class="src-sym">)</span><span class="src-sym">;&nbsp;</span><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a317"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a318"></a>&nbsp;&nbsp;<span class="src-var">$maxCount&nbsp;</span>=&nbsp;<a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$xclicks</span><span class="src-sym">)&nbsp;</span>-&nbsp;<span class="src-num">1</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a319"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;transform&nbsp;points</span></div></li>
<li><div class="src-line"><a name="a320"></a>&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$xclicks&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$i&nbsp;</span>=&gt;&nbsp;<span class="src-var">$value</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a321"></a>&nbsp;&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a322"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$p&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../smt2/Point.html">Point</a></span><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">,&nbsp;</span><span class="src-var">$yclicks</span><span class="src-sym">[</span><span class="src-var">$i</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a323"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;check&nbsp;if&nbsp;next&nbsp;point&nbsp;exists</span></div></li>
<li><div class="src-line"><a name="a324"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$i&nbsp;</span>&gt;=&nbsp;<span class="src-var">$maxCount</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{&nbsp;</span><span class="src-key">break</span><span class="src-sym">;&nbsp;</span><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a325"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a326"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$q&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../smt2/Point.html">Point</a></span><span class="src-sym">(</span><span class="src-var">$xclicks</span><span class="src-sym">[</span><span class="src-var">$i&nbsp;</span>+&nbsp;<span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">,&nbsp;</span><span class="src-var">$yclicks</span><span class="src-sym">[</span><span class="src-var">$i&nbsp;</span>+&nbsp;<span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a327"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$p</span><span class="src-sym">-&gt;</span><span class="src-id">getDistance</span><span class="src-sym">(</span><span class="src-var">$q</span><span class="src-sym">)&nbsp;</span>&gt;&nbsp;<span class="src-num">0&nbsp;</span>&amp;&amp;&nbsp;<span class="src-sym">!</span><span class="src-var">$q</span><span class="src-sym">-&gt;</span><span class="src-id">x</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a328"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$numClicks</span>++<span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a329"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a330"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a331"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a332"></a>&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$numClicks</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a333"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a334"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a335"></a><span class="src-doc">/**&nbsp;</span></div></li>
<li><div class="src-line"><a name="a336"></a><span class="src-doc">&nbsp;*&nbsp;Gets&nbsp;installed&nbsp;extensions&nbsp;priorities.</span></div></li>
<li><div class="src-line"><a name="a337"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-type">array&nbsp;</span><span class="src-doc">&nbsp;&nbsp;Array&nbsp;with&nbsp;keys:&nbsp;dir&nbsp;name&nbsp;(string)&nbsp;=&gt;&nbsp;order&nbsp;priority&nbsp;(int)</span></div></li>
<li><div class="src-line"><a name="a338"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a339"></a><span class="src-key">function&nbsp;</span><a href="../smt2/_functions.php.html#functionget_exts_order">get_exts_order</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span></div></li>
<li><div class="src-line"><a name="a340"></a><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a341"></a>&nbsp;&nbsp;<span class="src-var">$exts&nbsp;</span>=&nbsp;<a href="../smt2/_functions.db.php.html#functiondb_select_all">db_select_all</a><span class="src-sym">(</span><span class="src-id">TBL_PREFIX</span>.<span class="src-id"><a href="../smt2/_define.php.html#defineTBL_EXTS">TBL_EXTS</a></span><span class="src-sym">,&nbsp;</span><span class="src-str">&quot;*&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-str">&quot;1&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a342"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a343"></a>&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$exts&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$ext</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a344"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$priority</span><span class="src-sym">[&nbsp;</span><span class="src-var">$ext</span><span class="src-sym">[</span><span class="src-str">'dir'</span><span class="src-sym">]&nbsp;]&nbsp;</span>=&nbsp;(int)&nbsp;<span class="src-var">$ext</span><span class="src-sym">[</span><span class="src-str">'priority'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a345"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a346"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;sort&nbsp;maintaining&nbsp;index&nbsp;association</span></div></li>
<li><div class="src-line"><a name="a347"></a>&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/max">max</a><span class="src-sym">(</span><span class="src-var">$priority</span><span class="src-sym">)&nbsp;</span>&gt;&nbsp;<span class="src-num">0</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{&nbsp;</span><a href="http://www.php.net/asort">asort</a><span class="src-sym">(</span><span class="src-var">$priority</span><span class="src-sym">)</span><span class="src-sym">;&nbsp;</span><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a348"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a349"></a>&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$priority</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a350"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a351"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a352"></a><span class="src-doc">/**&nbsp;</span></div></li>
<li><div class="src-line"><a name="a353"></a><span class="src-doc">&nbsp;*&nbsp;Gets&nbsp;all&nbsp;available&nbsp;CMS&nbsp;sections.</span></div></li>
<li><div class="src-line"><a name="a354"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-type">array&nbsp;</span><span class="src-doc">&nbsp;&nbsp;Array&nbsp;of&nbsp;strings&nbsp;(sections)</span></div></li>
<li><div class="src-line"><a name="a355"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a356"></a><span class="src-key">function&nbsp;</span><a href="../smt2/_functions.php.html#functionext_available">ext_available</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span></div></li>
<li><div class="src-line"><a name="a357"></a><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a358"></a>&nbsp;&nbsp;<span class="src-var">$dir&nbsp;</span>=&nbsp;<span class="src-id">INC_PATH</span>.<span class="src-str">'ext'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a359"></a>&nbsp;&nbsp;<span class="src-var">$ext&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a360"></a>&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$handle&nbsp;</span>=&nbsp;<a href="http://www.php.net/opendir">opendir</a><span class="src-sym">(</span><span class="src-var">$dir</span><span class="src-sym">))&nbsp;</span></div></li>
<li><div class="src-line"><a name="a361"></a>&nbsp;&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a362"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">while&nbsp;</span><span class="src-sym">(</span><span class="src-id">false&nbsp;</span>!==&nbsp;<span class="src-sym">(</span><span class="src-var">$file&nbsp;</span>=&nbsp;<a href="http://www.php.net/readdir">readdir</a><span class="src-sym">(</span><span class="src-var">$handle</span><span class="src-sym">)))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a363"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;look&nbsp;for&nbsp;available&nbsp;module&nbsp;extensions</span></div></li>
<li><div class="src-line"><a name="a364"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$file&nbsp;</span>!=&nbsp;<span class="src-str">&quot;.&quot;&nbsp;</span>&amp;&amp;&nbsp;<span class="src-var">$file&nbsp;</span>!=&nbsp;<span class="src-str">&quot;..&quot;&nbsp;</span>&amp;&amp;&nbsp;<a href="http://www.php.net/is_dir">is_dir</a><span class="src-sym">(</span><span class="src-var">$dir</span>.<span class="src-str">'/'</span>.<span class="src-var">$file</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a365"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$ext</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$file</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a366"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a367"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a368"></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/closedir">closedir</a><span class="src-sym">(</span><span class="src-var">$handle</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a369"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a370"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a371"></a>&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$ext</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a372"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a373"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a374"></a><span class="src-doc">/**&nbsp;</span></div></li>
<li><div class="src-line"><a name="a375"></a><span class="src-doc">&nbsp;*&nbsp;Gives&nbsp;format&nbsp;to&nbsp;CMS&nbsp;sections.</span></div></li>
<li><div class="src-line"><a name="a376"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc">&nbsp;Formatted&nbsp;output&nbsp;list&nbsp;(LI&nbsp;elements)</span></div></li>
<li><div class="src-line"><a name="a377"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a378"></a><span class="src-key">function&nbsp;</span><a href="../smt2/_functions.php.html#functionext_format">ext_format</a><span class="src-sym">(</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a379"></a><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a380"></a>&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span>isset<span class="src-sym">(</span><span class="src-var">$_SESSION</span><span class="src-sym">[</span><span class="src-str">'allowed'</span><span class="src-sym">]</span><span class="src-sym">))&nbsp;</span><span class="src-key">return&nbsp;</span><span class="src-id">false</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a381"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a382"></a>&nbsp;&nbsp;<span class="src-var">$current&nbsp;</span>=&nbsp;<a href="../smt2/_functions.php.html#functionext_name">ext_name</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a383"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;check&nbsp;priority</span></div></li>
<li><div class="src-line"><a name="a384"></a>&nbsp;&nbsp;<span class="src-var">$prioritized&nbsp;</span>=&nbsp;<a href="../smt2/_functions.php.html#functionget_exts_order">get_exts_order</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a385"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;loop&nbsp;through&nbsp;available&nbsp;sections</span></div></li>
<li><div class="src-line"><a name="a386"></a>&nbsp;&nbsp;<span class="src-var">$list&nbsp;</span>=&nbsp;<span class="src-str">&quot;&quot;</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a387"></a>&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$prioritized&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$dir&nbsp;</span>=&gt;&nbsp;<span class="src-var">$priority</span><span class="src-sym">)&nbsp;</span></div></li>
<li><div class="src-line"><a name="a388"></a>&nbsp;&nbsp;<span class="src-sym">{&nbsp;</span></div></li>
<li><div class="src-line"><a name="a389"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/in_array">in_array</a><span class="src-sym">(</span><span class="src-var">$dir</span><span class="src-sym">,&nbsp;</span><span class="src-var">$_SESSION</span><span class="src-sym">[</span><span class="src-str">'allowed'</span><span class="src-sym">]</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{&nbsp;</span><span class="src-key">continue</span><span class="src-sym">;&nbsp;</span><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a390"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a391"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$css&nbsp;</span>=&nbsp;<span class="src-sym">(</span><span class="src-var">$current&nbsp;</span>==&nbsp;<span class="src-var">$dir</span><span class="src-sym">)&nbsp;</span>?&nbsp;<span class="src-str">'&nbsp;class=&quot;current&quot;'&nbsp;</span>:&nbsp;<span class="src-id">null</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a392"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$href&nbsp;</span>=&nbsp;<span class="src-id"><a href="../smt2/_define.php.html#defineADMIN_PATH">ADMIN_PATH</a></span>.<span class="src-str">'ext/'</span>.<span class="src-var">$dir</span>.<span class="src-str">'/'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a393"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$list&nbsp;</span>.=&nbsp;<span class="src-str">'&lt;li'</span>.<span class="src-var">$css</span>.<span class="src-str">'&gt;&lt;a&nbsp;href=&quot;'</span>.<span class="src-var">$href</span>.<span class="src-str">'&quot;&gt;'</span>.<a href="http://www.php.net/ucfirst">ucfirst</a><span class="src-sym">(</span><a href="../smt2/_functions.php.html#functionfilename_to_str">filename_to_str</a><span class="src-sym">(</span><span class="src-var">$dir</span><span class="src-sym">))</span>.<span class="src-str">'&lt;/a&gt;&lt;/li&gt;'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a394"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a395"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a396"></a>&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$list</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a397"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a398"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a399"></a><span class="src-doc">/**&nbsp;</span></div></li>
<li><div class="src-line"><a name="a400"></a><span class="src-doc">&nbsp;*&nbsp;Gets&nbsp;the&nbsp;current&nbsp;CMS&nbsp;extension&nbsp;name.</span></div></li>
<li><div class="src-line"><a name="a401"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;Section&nbsp;name</span></div></li>
<li><div class="src-line"><a name="a402"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a403"></a><span class="src-key">function&nbsp;</span><a href="../smt2/_functions.php.html#functionext_name">ext_name</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span></div></li>
<li><div class="src-line"><a name="a404"></a><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a405"></a>&nbsp;&nbsp;<span class="src-var">$ext&nbsp;</span>=&nbsp;<a href="http://www.php.net/explode">explode</a><span class="src-sym">(</span><span class="src-str">&quot;/&quot;</span><span class="src-sym">,&nbsp;</span><a href="http://www.php.net/dirname">dirname</a><span class="src-sym">(</span><span class="src-var">$_SERVER</span><span class="src-sym">[</span><span class="src-str">'PHP_SELF'</span><span class="src-sym">]</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a406"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a407"></a>&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$ext</span><span class="src-sym">[&nbsp;</span><a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$ext</span><span class="src-sym">)&nbsp;</span>-&nbsp;<span class="src-num">1&nbsp;</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a408"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a409"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a410"></a><span class="src-doc">/**&nbsp;</span></div></li>
<li><div class="src-line"><a name="a411"></a><span class="src-doc">&nbsp;*&nbsp;Assigns&nbsp;a&nbsp;valid&nbsp;filename&nbsp;to&nbsp;a&nbsp;given&nbsp;string:&nbsp;only&nbsp;alphanumeric&nbsp;chars.&nbsp;Spaces&nbsp;are&nbsp;converted&nbsp;to&nbsp;dashes.</span></div></li>
<li><div class="src-line"><a name="a412"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc">&nbsp;&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-var">$string&nbsp;</span><span class="src-doc">&nbsp;&nbsp;input&nbsp;string</span></div></li>
<li><div class="src-line"><a name="a413"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Normalized&nbsp;String</span></div></li>
<li><div class="src-line"><a name="a414"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a415"></a><span class="src-key">function&nbsp;</span><a href="../smt2/_functions.php.html#functionstr_to_filename">str_to_filename</a><span class="src-sym">(</span><span class="src-var">$string</span><span class="src-sym">)&nbsp;</span></div></li>
<li><div class="src-line"><a name="a416"></a><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a417"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;remove&nbsp;non&nbsp;alphanumeric&nbsp;chars</span></div></li>
<li><div class="src-line"><a name="a418"></a>&nbsp;&nbsp;<span class="src-var">$string&nbsp;</span>=&nbsp;<a href="http://www.php.net/preg_replace">preg_replace</a><span class="src-sym">(</span><span class="src-str">'/[^a-z0-9A-Z\s]+/'</span><span class="src-sym">,&nbsp;</span><span class="src-str">''</span><span class="src-sym">,&nbsp;</span><a href="http://www.php.net/strtolower">strtolower</a><span class="src-sym">(</span><span class="src-var">$string</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a419"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;now&nbsp;convert&nbsp;spaces&nbsp;to&nbsp;dashes</span></div></li>
<li><div class="src-line"><a name="a420"></a>&nbsp;&nbsp;<span class="src-var">$string&nbsp;</span>=&nbsp;<a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">&quot;&nbsp;&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-str">&quot;-&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-var">$string</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a421"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a422"></a>&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$string</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a423"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a424"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a425"></a><span class="src-doc">/**&nbsp;</span></div></li>
<li><div class="src-line"><a name="a426"></a><span class="src-doc">&nbsp;*&nbsp;Reverse&nbsp;function&nbsp;for&nbsp;str_to_filename.&nbsp;Dashes&nbsp;are&nbsp;converted&nbsp;to&nbsp;spaces.</span></div></li>
<li><div class="src-line"><a name="a427"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc">&nbsp;&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-var">$string&nbsp;</span><span class="src-doc">&nbsp;&nbsp;normalized&nbsp;String</span></div></li>
<li><div class="src-line"><a name="a428"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Output&nbsp;String</span></div></li>
<li><div class="src-line"><a name="a429"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a430"></a><span class="src-key">function&nbsp;</span><a href="../smt2/_functions.php.html#functionfilename_to_str">filename_to_str</a><span class="src-sym">(</span><span class="src-var">$string</span><span class="src-sym">)&nbsp;</span></div></li>
<li><div class="src-line"><a name="a431"></a><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a432"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;now&nbsp;convert&nbsp;dashes&nbsp;to&nbsp;spaces&nbsp;</span></div></li>
<li><div class="src-line"><a name="a433"></a>&nbsp;&nbsp;<span class="src-var">$string&nbsp;</span>=&nbsp;<a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">&quot;-&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-str">&quot;&nbsp;&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-var">$string</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a434"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a435"></a>&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$string</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a436"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a437"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a438"></a><span class="src-doc">/**&nbsp;</span></div></li>
<li><div class="src-line"><a name="a439"></a><span class="src-doc">&nbsp;*&nbsp;Adds&nbsp;$element&nbsp;tags&nbsp;to&nbsp;all&nbsp;CMS&nbsp;extensions&nbsp;header.</span></div></li>
<li><div class="src-line"><a name="a440"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc">&nbsp;&nbsp;</span><span class="src-doc-type">mixed&nbsp;</span><span class="src-doc">&nbsp;&nbsp;</span><span class="src-doc-var">$element&nbsp;</span><span class="src-doc">&nbsp;HTML&nbsp;code&nbsp;to&nbsp;insert&nbsp;in&nbsp;the&nbsp;HEAD&nbsp;of&nbsp;any&nbsp;CMS&nbsp;section&nbsp;(&lt;style&gt;,&nbsp;&lt;script&gt;,&nbsp;etc.).&nbsp;Can&nbsp;be&nbsp;a&nbsp;single&nbsp;string&nbsp;or&nbsp;an&nbsp;Array</span></div></li>
<li><div class="src-line"><a name="a441"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@global&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-type">array&nbsp;</span><span class="src-doc">&nbsp;&nbsp;</span><span class="src-doc-var">$_headAdded&nbsp;</span></div></li>
<li><div class="src-line"><a name="a442"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a443"></a><span class="src-key">function&nbsp;</span><a href="../smt2/_functions.php.html#functionadd_head">add_head</a><span class="src-sym">(</span><span class="src-var">$element</span><span class="src-sym">)&nbsp;</span></div></li>
<li><div class="src-line"><a name="a444"></a><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a445"></a>&nbsp;&nbsp;<span class="src-key">global&nbsp;</span><a href="../smt2/_functions.php.html#global$_headAdded">$_headAdded</a><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a446"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a447"></a>&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$element</span><span class="src-sym">)&nbsp;</span><span class="src-key">return</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a448"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a449"></a>&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$element</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a450"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$element&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$value</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a451"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$_headAdded</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$value</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a452"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a453"></a>&nbsp;&nbsp;<span class="src-sym">}&nbsp;</span><span class="src-key">else&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a454"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$_headAdded</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$element</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a455"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a456"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a457"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a458"></a><span class="src-doc">/**&nbsp;</span></div></li>
<li><div class="src-line"><a name="a459"></a><span class="src-doc">&nbsp;*&nbsp;Displays&nbsp;a&nbsp;&lt;noscript&gt;&nbsp;warning&nbsp;message.&nbsp;Useful&nbsp;for&nbsp;those&nbsp;extensions&nbsp;that&nbsp;require&nbsp;JavaScript&nbsp;functionality.</span></div></li>
<li><div class="src-line"><a name="a460"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc">&nbsp;&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-var">$msg&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;custom&nbsp;warning&nbsp;message.&nbsp;Default:&nbsp;&quot;Please&nbsp;enable&nbsp;JavaScript&nbsp;in&nbsp;order&nbsp;to&nbsp;work&nbsp;on&nbsp;this&nbsp;section.&quot;</span></div></li>
<li><div class="src-line"><a name="a461"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Message&nbsp;wrapped&nbsp;in&nbsp;a&nbsp;&lt;noscript&gt;&nbsp;tag</span></div></li>
<li><div class="src-line"><a name="a462"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a463"></a><span class="src-key">function&nbsp;</span><a href="../smt2/_functions.php.html#functioncheck_noscript">check_noscript</a><span class="src-sym">(</span><span class="src-var">$msg&nbsp;</span>=&nbsp;<span class="src-str">&quot;&quot;</span><span class="src-sym">)&nbsp;</span></div></li>
<li><div class="src-line"><a name="a464"></a><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a465"></a>&nbsp;&nbsp;<span class="src-key">global&nbsp;</span><a href="../smt2/_messages.php.html#global$_displayType">$_displayType</a><span class="src-sym">,&nbsp;</span><a href="../smt2/_messages.php.html#global$_notifyMsg">$_notifyMsg</a><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a466"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a467"></a>&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$msg</span><span class="src-sym">))&nbsp;</span><span class="src-var">$msg&nbsp;</span>=&nbsp;<span class="src-var">$_notifyMsg</span><span class="src-sym">[</span><span class="src-str">&quot;NOSCRIPT&quot;</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a468"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a469"></a>&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-str">'&lt;noscript&gt;'</span>.<a href="../smt2/_functions.php.html#functiondisplay_text">display_text</a><span class="src-sym">(</span><span class="src-var">$_displayType</span><span class="src-sym">[</span><span class="src-str">&quot;WARNING&quot;</span><span class="src-sym">]</span><span class="src-sym">,&nbsp;</span><span class="src-var">$msg</span><span class="src-sym">)</span>.<span class="src-str">'&lt;/noscript&gt;'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a470"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a471"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a472"></a><span class="src-doc">/**&nbsp;</span></div></li>
<li><div class="src-line"><a name="a473"></a><span class="src-doc">&nbsp;*&nbsp;Count&nbsp;files&nbsp;in&nbsp;a&nbsp;dir.&nbsp;This&nbsp;function&nbsp;skip&nbsp;directories,&nbsp;and&nbsp;it&nbsp;is&nbsp;not&nbsp;recursive.</span></div></li>
<li><div class="src-line"><a name="a474"></a><span class="src-doc">&nbsp;*&nbsp;By&nbsp;now&nbsp;it&nbsp;is&nbsp;only&nbsp;used&nbsp;to&nbsp;check&nbsp;the&nbsp;cache&nbsp;logs.</span></div></li>
<li><div class="src-line"><a name="a475"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc">&nbsp;&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-var">$dir&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;the&nbsp;directory&nbsp;to&nbsp;read&nbsp;files&nbsp;from</span></div></li>
<li><div class="src-line"><a name="a476"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-type">int&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Number&nbsp;of&nbsp;files</span></div></li>
<li><div class="src-line"><a name="a477"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a478"></a><span class="src-key">function&nbsp;</span><a href="../smt2/_functions.php.html#functioncount_dir_files">count_dir_files</a><span class="src-sym">(</span><span class="src-var">$dir</span><span class="src-sym">)&nbsp;</span></div></li>
<li><div class="src-line"><a name="a479"></a><span class="src-sym">{&nbsp;&nbsp;</span></div></li>
<li><div class="src-line"><a name="a480"></a>&nbsp;&nbsp;<span class="src-var">$count&nbsp;</span>=&nbsp;<span class="src-num">0</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a481"></a>&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$handle&nbsp;</span>=&nbsp;<a href="http://www.php.net/opendir">opendir</a><span class="src-sym">(</span><span class="src-var">$dir</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a482"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">while&nbsp;</span><span class="src-sym">(</span><span class="src-id">false&nbsp;</span>!==&nbsp;<span class="src-sym">(</span><span class="src-var">$file&nbsp;</span>=&nbsp;<a href="http://www.php.net/readdir">readdir</a><span class="src-sym">(</span><span class="src-var">$handle</span><span class="src-sym">)))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a483"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$file&nbsp;</span>!=&nbsp;<span class="src-str">&quot;.&quot;&nbsp;</span>&amp;&amp;&nbsp;<span class="src-var">$file&nbsp;</span>!=&nbsp;<span class="src-str">&quot;..&quot;&nbsp;</span>&amp;&amp;&nbsp;<a href="http://www.php.net/is_file">is_file</a><span class="src-sym">(</span><span class="src-var">$dir</span>.<span class="src-str">'/'</span>.<span class="src-var">$file</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a484"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$count</span>++<span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a485"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a486"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a487"></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/closedir">closedir</a><span class="src-sym">(</span><span class="src-var">$handle</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a488"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a489"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a490"></a>&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$count</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a491"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a492"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a493"></a><span class="src-doc">/**&nbsp;</span></div></li>
<li><div class="src-line"><a name="a494"></a><span class="src-doc">&nbsp;*&nbsp;Verifies&nbsp;that&nbsp;current&nbsp;login&nbsp;has&nbsp;admin&nbsp;privileges.</span></div></li>
<li><div class="src-line"><a name="a495"></a><span class="src-doc">&nbsp;*&nbsp;Note&nbsp;that&nbsp;various&nbsp;admin&nbsp;users&nbsp;can&nbsp;coexist&nbsp;on&nbsp;the&nbsp;CMS.</span></div></li>
<li><div class="src-line"><a name="a496"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-type">boolean&nbsp;</span><span class="src-doc">&nbsp;&nbsp;TRUE&nbsp;on&nbsp;sucess,&nbsp;or&nbsp;FALSE&nbsp;on&nbsp;failure</span></div></li>
<li><div class="src-line"><a name="a497"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a498"></a><span class="src-key">function&nbsp;</span><a href="../smt2/_functions.php.html#functionis_admin">is_admin</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span></div></li>
<li><div class="src-line"><a name="a499"></a><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a500"></a>&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span>isset<span class="src-sym">(</span><span class="src-var">$_SESSION</span><span class="src-sym">[</span><span class="src-str">'login'</span><span class="src-sym">]</span><span class="src-sym">))&nbsp;</span><span class="src-key">return&nbsp;</span><span class="src-id">false</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a501"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a502"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;get&nbsp;admin&nbsp;role_id</span></div></li>
<li><div class="src-line"><a name="a503"></a>&nbsp;&nbsp;<span class="src-var">$user&nbsp;</span>=&nbsp;<a href="../smt2/_functions.db.php.html#functiondb_select">db_select</a><span class="src-sym">(</span><span class="src-id">TBL_PREFIX</span>.<span class="src-id"><a href="../smt2/_define.php.html#defineTBL_USERS">TBL_USERS</a></span><span class="src-sym">,&nbsp;</span><span class="src-str">&quot;role_id&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-str">&quot;login&nbsp;=&nbsp;'&quot;</span>.<span class="src-var">$_SESSION</span><span class="src-sym">[</span><span class="src-str">'login'</span><span class="src-sym">]</span>.<span class="src-str">&quot;'&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a504"></a>&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-sym">(&nbsp;</span>(int)&nbsp;<span class="src-var">$user</span><span class="src-sym">[</span><span class="src-str">'role_id'</span><span class="src-sym">]&nbsp;</span>===&nbsp;<span class="src-num">1&nbsp;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a505"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a506"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a507"></a><span class="src-doc">/**&nbsp;</span></div></li>
<li><div class="src-line"><a name="a508"></a><span class="src-doc">&nbsp;*&nbsp;Verifies&nbsp;that&nbsp;current&nbsp;login&nbsp;is&nbsp;the&nbsp;superadmin&nbsp;user.</span></div></li>
<li><div class="src-line"><a name="a509"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-type">boolean&nbsp;</span><span class="src-doc">&nbsp;&nbsp;TRUE&nbsp;on&nbsp;sucess,&nbsp;or&nbsp;FALSE&nbsp;on&nbsp;failure</span></div></li>
<li><div class="src-line"><a name="a510"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a511"></a><span class="src-key">function&nbsp;</span><a href="../smt2/_functions.php.html#functionis_root">is_root</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span></div></li>
<li><div class="src-line"><a name="a512"></a><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a513"></a>&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span>isset<span class="src-sym">(</span><span class="src-var">$_SESSION</span><span class="src-sym">[</span><span class="src-str">'login'</span><span class="src-sym">]</span><span class="src-sym">))&nbsp;</span><span class="src-key">return&nbsp;</span><span class="src-id">false</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a514"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a515"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;get&nbsp;root&nbsp;role_id</span></div></li>
<li><div class="src-line"><a name="a516"></a>&nbsp;&nbsp;<span class="src-var">$user&nbsp;</span>=&nbsp;<a href="../smt2/_functions.db.php.html#functiondb_select">db_select</a><span class="src-sym">(</span><span class="src-id">TBL_PREFIX</span>.<span class="src-id"><a href="../smt2/_define.php.html#defineTBL_USERS">TBL_USERS</a></span><span class="src-sym">,&nbsp;</span><span class="src-str">&quot;id&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-str">&quot;login&nbsp;=&nbsp;'&quot;</span>.<span class="src-var">$_SESSION</span><span class="src-sym">[</span><span class="src-str">'login'</span><span class="src-sym">]</span>.<span class="src-str">&quot;'&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a517"></a>&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-sym">(&nbsp;</span>(int)&nbsp;<span class="src-var">$user</span><span class="src-sym">[</span><span class="src-str">'id'</span><span class="src-sym">]&nbsp;</span>===&nbsp;<span class="src-num">1&nbsp;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a518"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a519"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a520"></a><span class="src-doc">/**&nbsp;</span></div></li>
<li><div class="src-line"><a name="a521"></a><span class="src-doc">&nbsp;*&nbsp;Gets&nbsp;all&nbsp;allowed&nbsp;CMS&nbsp;extensions&nbsp;for&nbsp;the&nbsp;current&nbsp;user.</span></div></li>
<li><div class="src-line"><a name="a522"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-type">array&nbsp;</span><span class="src-doc">&nbsp;&nbsp;Array&nbsp;of&nbsp;strings&nbsp;(sections)</span></div></li>
<li><div class="src-line"><a name="a523"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a524"></a><span class="src-key">function&nbsp;</span><a href="../smt2/_functions.php.html#functionis_allowed">is_allowed</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span></div></li>
<li><div class="src-line"><a name="a525"></a><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a526"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;check&nbsp;current&nbsp;user's&nbsp;role</span></div></li>
<li><div class="src-line"><a name="a527"></a>&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$_SESSION</span><span class="src-sym">[</span><span class="src-str">'role_id'</span><span class="src-sym">]&nbsp;</span>&gt;&nbsp;<span class="src-num">0</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a528"></a>&nbsp;&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a529"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$user&nbsp;</span>=&nbsp;<a href="../smt2/_functions.db.php.html#functiondb_select">db_select</a><span class="src-sym">(</span><span class="src-id">TBL_PREFIX</span>.<span class="src-id"><a href="../smt2/_define.php.html#defineTBL_USERS">TBL_USERS</a></span><span class="src-sym">,&nbsp;</span><span class="src-str">&quot;role_id&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-str">&quot;login&nbsp;=&nbsp;'&quot;</span>.<span class="src-var">$_SESSION</span><span class="src-sym">[</span><span class="src-str">'login'</span><span class="src-sym">]</span>.<span class="src-str">&quot;'&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a530"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(&nbsp;</span>(int)&nbsp;<span class="src-var">$user</span><span class="src-sym">[</span><span class="src-str">'role_id'</span><span class="src-sym">]&nbsp;</span>!==&nbsp;<span class="src-num">1&nbsp;</span><span class="src-sym">)&nbsp;</span></div></li>
<li><div class="src-line"><a name="a531"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a532"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$current&nbsp;</span>=&nbsp;<a href="../smt2/_functions.php.html#functionext_name">ext_name</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a533"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;check&nbsp;if&nbsp;current&nbsp;section&nbsp;is&nbsp;allowed</span></div></li>
<li><div class="src-line"><a name="a534"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$current</span><span class="src-sym">,&nbsp;</span><span class="src-var">$_SESSION</span><span class="src-sym">[</span><span class="src-str">'ext_allowed'</span><span class="src-sym">]</span><span class="src-sym">)&nbsp;</span>!==&nbsp;<span class="src-id">false</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a535"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}&nbsp;</span><span class="src-key">else&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a536"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id">true</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a537"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a538"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a539"></a>&nbsp;&nbsp;<span class="src-key">else&nbsp;</span></div></li>
<li><div class="src-line"><a name="a540"></a>&nbsp;&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a541"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id">false</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a542"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a543"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a544"></a>&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a545"></a><span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a546"></a><span class="src-doc">&nbsp;*&nbsp;Random&nbsp;Password&nbsp;Generator.</span></div></li>
<li><div class="src-line"><a name="a547"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-tag">@autor</span><span class="src-doc">&nbsp;Charlie</span></div></li>
<li><div class="src-line"><a name="a548"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@link</span><span class="src-doc">&nbsp;http://snippets.dzone.com/user/Charlie</span></div></li>
<li><div class="src-line"><a name="a549"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@version</span><span class="src-doc">&nbsp;0.1.0&nbsp;-&nbsp;2006-02-14</span></div></li>
<li><div class="src-line"><a name="a550"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a551"></a><span class="src-key">function&nbsp;</span><a href="../smt2/_functions.php.html#functiongenerate_password">generate_password</a><span class="src-sym">(</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a552"></a><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a553"></a>&nbsp;&nbsp;<span class="src-var">$pwd&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span></div></li>
<li><div class="src-line"><a name="a554"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-str">&quot;C&quot;&nbsp;</span>=&gt;&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'chars'&nbsp;</span>=&gt;&nbsp;<span class="src-str">'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'</span><span class="src-sym">,&nbsp;</span><span class="src-str">'min'&nbsp;</span>=&gt;&nbsp;<span class="src-num">4</span><span class="src-sym">,&nbsp;</span><span class="src-str">'max'&nbsp;</span>=&gt;&nbsp;<span class="src-num">6</span><span class="src-sym">)</span><span class="src-sym">,</span></div></li>
<li><div class="src-line"><a name="a555"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-str">&quot;S&quot;&nbsp;</span>=&gt;&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'chars'&nbsp;</span>=&gt;&nbsp;<span class="src-str">&quot;!@()-_=+?*^&amp;&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-str">'min'&nbsp;</span>=&gt;&nbsp;<span class="src-num">1</span><span class="src-sym">,&nbsp;</span><span class="src-str">'max'&nbsp;</span>=&gt;&nbsp;<span class="src-num">2</span><span class="src-sym">)</span><span class="src-sym">,</span></div></li>
<li><div class="src-line"><a name="a556"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-str">&quot;N&quot;&nbsp;</span>=&gt;&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'chars'&nbsp;</span>=&gt;&nbsp;<span class="src-str">'1234567890'</span><span class="src-sym">,&nbsp;</span><span class="src-str">'min'&nbsp;</span>=&gt;&nbsp;<span class="src-num">2</span><span class="src-sym">,&nbsp;</span><span class="src-str">'max'&nbsp;</span>=&gt;&nbsp;<span class="src-num">2</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a557"></a>&nbsp;&nbsp;<span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a558"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Create&nbsp;the&nbsp;meta-password</span></div></li>
<li><div class="src-line"><a name="a559"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$meta&nbsp;</span>=&nbsp;<span class="src-str">&quot;&quot;</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a560"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$pwd&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$cToken&nbsp;</span>=&gt;&nbsp;<span class="src-var">$seed</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a561"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$meta&nbsp;</span>.=&nbsp;<a href="http://www.php.net/str_repeat">str_repeat</a><span class="src-sym">(</span><span class="src-var">$cToken</span><span class="src-sym">,&nbsp;</span><a href="http://www.php.net/rand">rand</a><span class="src-sym">(</span><span class="src-var">$seed</span><span class="src-sym">[</span><span class="src-str">'min'</span><span class="src-sym">]</span><span class="src-sym">,&nbsp;</span><span class="src-var">$seed</span><span class="src-sym">[</span><span class="src-str">'max'</span><span class="src-sym">]</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a562"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a563"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$meta&nbsp;</span>=&nbsp;<a href="http://www.php.net/str_shuffle">str_shuffle</a><span class="src-sym">(</span><span class="src-var">$meta</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a564"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Create&nbsp;the&nbsp;real&nbsp;password</span></div></li>
<li><div class="src-line"><a name="a565"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$buffer&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a566"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">for&nbsp;</span><span class="src-sym">(</span><span class="src-var">$i&nbsp;</span>=&nbsp;<span class="src-num">0</span><span class="src-sym">;&nbsp;</span><span class="src-var">$i&nbsp;</span>&lt;&nbsp;<a href="http://www.php.net/strlen">strlen</a><span class="src-sym">(</span><span class="src-var">$meta</span><span class="src-sym">)</span><span class="src-sym">;&nbsp;</span>++<span class="src-var">$i</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a567"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$buffer</span><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$pwd</span><span class="src-sym">[</span>(string)<span class="src-var">$meta</span><span class="src-sym">[</span><span class="src-var">$i</span><span class="src-sym">]]</span><span class="src-sym">[</span><span class="src-str">'chars'</span><span class="src-sym">]</span><span class="src-sym">[</span><a href="http://www.php.net/rand">rand</a><span class="src-sym">(</span><span class="src-num">0</span><span class="src-sym">,&nbsp;</span><a href="http://www.php.net/strlen">strlen</a><span class="src-sym">(</span><span class="src-var">$pwd</span><span class="src-sym">[</span><span class="src-var">$meta</span><span class="src-sym">[</span><span class="src-var">$i</span><span class="src-sym">]]</span><span class="src-sym">[</span><span class="src-str">'chars'</span><span class="src-sym">]</span><span class="src-sym">)&nbsp;</span>-&nbsp;<span class="src-num">1</span><span class="src-sym">)</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a568"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a569"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a570"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><a href="http://www.php.net/implode">implode</a><span class="src-sym">(</span><span class="src-str">&quot;&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-var">$buffer</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a571"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a572"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a573"></a><span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a574"></a><span class="src-doc">&nbsp;*&nbsp;Checks&nbsp;if&nbsp;an&nbsp;email&nbsp;address&nbsp;is&nbsp;valid.</span></div></li>
<li><div class="src-line"><a name="a575"></a><span class="src-doc">&nbsp;*&nbsp;The&nbsp;chars&nbsp;#&nbsp;$&nbsp;%&nbsp;&amp;&nbsp;'&nbsp;*&nbsp;+&nbsp;/&nbsp;=&nbsp;?&nbsp;^&nbsp;`&nbsp;{&nbsp;|&nbsp;}&nbsp;~&nbsp;are&nbsp;theoretically&nbsp;allowed&nbsp;on&nbsp;the&nbsp;local&nbsp;part,</span></div></li>
<li><div class="src-line"><a name="a576"></a><span class="src-doc">&nbsp;*&nbsp;but&nbsp;in&nbsp;practice&nbsp;they&nbsp;are&nbsp;discarded.</span></div></li>
<li><div class="src-line"><a name="a577"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc">&nbsp;&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;</span><span class="src-doc-var">$email&nbsp;</span><span class="src-doc">&nbsp;email&nbsp;to&nbsp;check</span></div></li>
<li><div class="src-line"><a name="a578"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-type">boolean&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TRUE&nbsp;on&nbsp;sucess,&nbsp;or&nbsp;FALSE&nbsp;on&nbsp;failure</span></div></li>
<li><div class="src-line"><a name="a579"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@link</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;http://tools.ietf.org/html/rfc5321</span></div></li>
<li><div class="src-line"><a name="a580"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@link</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;http://tools.ietf.org/html/rfc5322</span></div></li>
<li><div class="src-line"><a name="a581"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a582"></a><span class="src-key">function&nbsp;</span><a href="../smt2/_functions.php.html#functionis_email">is_email</a><span class="src-sym">(</span><span class="src-var">$email</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a583"></a><span class="src-sym">{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></div></li>
<li><div class="src-line"><a name="a584"></a>&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><a href="http://www.php.net/eregi">eregi</a><span class="src-sym">(</span><span class="src-str">&quot;^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-var">$email</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a585"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a586"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a587"></a><span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a588"></a><span class="src-doc">&nbsp;*&nbsp;Searches&nbsp;DNS&nbsp;for&nbsp;MX&nbsp;records&nbsp;corresponding&nbsp;to&nbsp;user's&nbsp;email&nbsp;account&nbsp;hostname.</span></div></li>
<li><div class="src-line"><a name="a589"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc">&nbsp;&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;</span><span class="src-doc-var">$email&nbsp;</span><span class="src-doc">&nbsp;user&nbsp;email</span></div></li>
<li><div class="src-line"><a name="a590"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-type">boolean&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TRUE&nbsp;on&nbsp;sucess,&nbsp;or&nbsp;FALSE&nbsp;on&nbsp;failure</span></div></li>
<li><div class="src-line"><a name="a591"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a592"></a><span class="src-key">function&nbsp;</span><a href="../smt2/_functions.php.html#functionemail_exists">email_exists</a><span class="src-sym">(</span><span class="src-var">$email</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a593"></a><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a594"></a>&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><a href="../smt2/_functions.php.html#functionis_email">is_email</a><span class="src-sym">(</span><span class="src-var">$email</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{&nbsp;</span><span class="src-key">return&nbsp;</span><span class="src-id">false</span><span class="src-sym">;&nbsp;</span><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a595"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a596"></a>&nbsp;&nbsp;list<span class="src-sym">(</span><span class="src-var">$user</span><span class="src-sym">,&nbsp;</span><span class="src-var">$domain</span><span class="src-sym">)&nbsp;</span>=&nbsp;<a href="http://www.php.net/split">split</a><span class="src-sym">(</span><span class="src-str">&quot;@&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-var">$email</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a597"></a>&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/function_exists">function_exists</a><span class="src-sym">(</span><span class="src-str">'getmxrr'</span><span class="src-sym">)&nbsp;</span>&amp;&amp;&nbsp;<span class="src-id">getmxrr</span><span class="src-sym">(</span><span class="src-var">$domain</span><span class="src-sym">,&nbsp;</span><span class="src-var">$MXHost</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a598"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id">true</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a599"></a>&nbsp;&nbsp;<span class="src-sym">}&nbsp;</span><span class="src-key">else&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a600"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/fsockopen">fsockopen</a><span class="src-sym">(</span><span class="src-var">$domain</span><span class="src-sym">,&nbsp;</span><span class="src-num">80</span><span class="src-sym">,&nbsp;</span><span class="src-var">$errno</span><span class="src-sym">,&nbsp;</span><span class="src-var">$errstr</span><span class="src-sym">,&nbsp;</span><span class="src-num">30</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a601"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a602"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a603"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a604"></a><span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a605"></a><span class="src-doc">&nbsp;*&nbsp;Stops&nbsp;executing&nbsp;a&nbsp;PHP&nbsp;script,&nbsp;displaying&nbsp;a&nbsp;reason&nbsp;for&nbsp;the&nbsp;error.</span></div></li>
<li><div class="src-line"><a name="a606"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc">&nbsp;&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;</span><span class="src-doc-var">$text&nbsp;</span><span class="src-doc">&nbsp;message</span></div></li>
<li><div class="src-line"><a name="a607"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a608"></a><span class="src-key">function&nbsp;</span><a href="../smt2/_functions.php.html#functiondie_msg">die_msg</a><span class="src-sym">(</span><span class="src-var">$text&nbsp;</span>=&nbsp;<span class="src-str">&quot;&quot;</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a609"></a><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a610"></a>&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$text</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{&nbsp;</span><span class="src-var">$text&nbsp;</span>=&nbsp;<span class="src-str">&quot;:&nbsp;&quot;</span>.<span class="src-var">$text</span><span class="src-sym">;&nbsp;</span><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a611"></a>&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a612"></a>&nbsp;&nbsp;<span class="src-key">die</span><span class="src-sym">(</span><span class="src-str">&quot;&lt;strong&gt;Error&lt;/strong&gt;&quot;</span>.<span class="src-var">$text</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a613"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a614"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a615"></a><span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a616"></a><span class="src-doc">&nbsp;*&nbsp;Pad&nbsp;with&nbsp;zeros&nbsp;a&nbsp;number.</span></div></li>
<li><div class="src-line"><a name="a617"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">int&nbsp;</span><span class="src-doc-var">$num&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;input&nbsp;number</span></div></li>
<li><div class="src-line"><a name="a618"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">int&nbsp;</span><span class="src-doc-var">$numZeros&nbsp;</span><span class="src-doc">number&nbsp;of&nbsp;zeros</span></div></li>
<li><div class="src-line"><a name="a619"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a620"></a><span class="src-key">function&nbsp;</span><a href="../smt2/_functions.php.html#functionpad_number">pad_number</a><span class="src-sym">(</span><span class="src-var">$num</span><span class="src-sym">,&nbsp;</span><span class="src-var">$numZeros</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a621"></a><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a622"></a>&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><a href="http://www.php.net/sprintf">sprintf</a><span class="src-sym">(</span><span class="src-str">&quot;%0&quot;</span>.<span class="src-var">$numZeros</span>.<span class="src-str">&quot;d&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-var">$num</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a623"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a624"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a625"></a><span class="src-doc">/**&nbsp;Emulates&nbsp;register_globals&nbsp;off.&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a626"></a><span class="src-key">function&nbsp;</span><a href="../smt2/_functions.php.html#functionunregister_GLOBALS">unregister_GLOBALS</a><span class="src-sym">(</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a627"></a><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a628"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/ini_get">ini_get</a><span class="src-sym">(</span><span class="src-str">'register_globals'</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a629"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a630"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a631"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a632"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;might&nbsp;want&nbsp;to&nbsp;change&nbsp;this&nbsp;perhaps&nbsp;to&nbsp;a&nbsp;nicer&nbsp;error</span></div></li>
<li><div class="src-line"><a name="a633"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$_REQUEST</span><span class="src-sym">[</span><span class="src-str">'GLOBALS'</span><span class="src-sym">]</span><span class="src-sym">)&nbsp;</span>||&nbsp;isset<span class="src-sym">(</span><span class="src-var">$_FILES</span><span class="src-sym">[</span><span class="src-str">'GLOBALS'</span><span class="src-sym">]</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a634"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">die</span><span class="src-sym">(</span><span class="src-str">'GLOBALS&nbsp;overwrite&nbsp;attempt&nbsp;detected'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a635"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a636"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a637"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;variables&nbsp;that&nbsp;shouldn't&nbsp;be&nbsp;unset</span></div></li>
<li><div class="src-line"><a name="a638"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$noUnset&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'GLOBALS'</span><span class="src-sym">,&nbsp;&nbsp;</span><span class="src-str">'_GET'</span><span class="src-sym">,</span></div></li>
<li><div class="src-line"><a name="a639"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-str">'_POST'</span><span class="src-sym">,&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str">'_COOKIE'</span><span class="src-sym">,</span></div></li>
<li><div class="src-line"><a name="a640"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-str">'_REQUEST'</span><span class="src-sym">,&nbsp;</span><span class="src-str">'_SERVER'</span><span class="src-sym">,</span></div></li>
<li><div class="src-line"><a name="a641"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-str">'_ENV'</span><span class="src-sym">,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str">'_FILES'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a642"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a643"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$input&nbsp;</span>=&nbsp;<a href="http://www.php.net/array_merge">array_merge</a><span class="src-sym">(</span><span class="src-var">$_GET</span><span class="src-sym">,&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-var">$_POST</span><span class="src-sym">,</span></div></li>
<li><div class="src-line"><a name="a644"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$_COOKIE</span><span class="src-sym">,&nbsp;</span><span class="src-var">$_SERVER</span><span class="src-sym">,</span></div></li>
<li><div class="src-line"><a name="a645"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$_ENV</span><span class="src-sym">,&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-var">$_FILES</span><span class="src-sym">,</span></div></li>
<li><div class="src-line"><a name="a646"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;isset<span class="src-sym">(</span><span class="src-var">$_SESSION</span><span class="src-sym">)&nbsp;</span>&amp;&amp;&nbsp;<a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$_SESSION</span><span class="src-sym">)&nbsp;</span>?&nbsp;<span class="src-var">$_SESSION&nbsp;</span>:&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a647"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a648"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$input&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$k&nbsp;</span>=&gt;&nbsp;<span class="src-var">$v</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a649"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/in_array">in_array</a><span class="src-sym">(</span><span class="src-var">$k</span><span class="src-sym">,&nbsp;</span><span class="src-var">$noUnset</span><span class="src-sym">)&nbsp;</span>&amp;&amp;&nbsp;isset<span class="src-sym">(</span><span class="src-var">$GLOBALS</span><span class="src-sym">[</span><span class="src-var">$k</span><span class="src-sym">]</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a650"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;unset<span class="src-sym">(</span><span class="src-var">$GLOBALS</span><span class="src-sym">[</span><span class="src-var">$k</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a651"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a652"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a653"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a654"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a655"></a><span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a656"></a><span class="src-doc">&nbsp;*&nbsp;Gets&nbsp;a&nbsp;SQL-like&nbsp;string&nbsp;with&nbsp;all&nbsp;cache&nbsp;IDs&nbsp;that&nbsp;are&nbsp;related&nbsp;to&nbsp;the&nbsp;same&nbsp;URL.</span></div></li>
<li><div class="src-line"><a name="a657"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc">&nbsp;&nbsp;</span><span class="src-doc-type">int&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;Log&nbsp;cache&nbsp;ID</span></div></li>
<li><div class="src-line"><a name="a658"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc">&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc">&nbsp;SQL&nbsp;query</span></div></li>
<li><div class="src-line"><a name="a659"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a660"></a><span class="src-key">function&nbsp;</span><a href="../smt2/_functions.php.html#functionget_cache_common_url">get_cache_common_url</a><span class="src-sym">(</span><span class="src-var">$pageId</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a661"></a><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a662"></a>&nbsp;&nbsp;<span class="src-var">$common&nbsp;</span>=&nbsp;<a href="../smt2/_functions.db.php.html#functiondb_select">db_select</a><span class="src-sym">(</span><span class="src-id">TBL_PREFIX</span>.<span class="src-id"><a href="../smt2/_define.php.html#defineTBL_CACHE">TBL_CACHE</a></span><span class="src-sym">,&nbsp;</span><span class="src-str">&quot;url&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-str">&quot;id&nbsp;=&nbsp;'&quot;</span>.<span class="src-var">$pageId</span>.<span class="src-str">&quot;'&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a663"></a>&nbsp;&nbsp;<span class="src-var">$moreId&nbsp;</span>=&nbsp;<a href="../smt2/_functions.db.php.html#functiondb_select_all">db_select_all</a><span class="src-sym">(</span><span class="src-id">TBL_PREFIX</span>.<span class="src-id"><a href="../smt2/_define.php.html#defineTBL_CACHE">TBL_CACHE</a></span><span class="src-sym">,&nbsp;</span><span class="src-str">&quot;id&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-str">&quot;url&nbsp;=&nbsp;'&quot;</span>.<span class="src-var">$common</span><span class="src-sym">[</span><span class="src-str">'url'</span><span class="src-sym">]</span>.<span class="src-str">&quot;'&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a664"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;merge&nbsp;values</span></div></li>
<li><div class="src-line"><a name="a665"></a>&nbsp;&nbsp;<span class="src-var">$moreId&nbsp;</span>=&nbsp;<a href="../smt2/_functions.array.php.html#functionarray_flatten">array_flatten</a><span class="src-sym">(</span><span class="src-var">$moreId</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a666"></a>&nbsp;&nbsp;<span class="src-comm">//&nbsp;set&nbsp;query</span></div></li>
<li><div class="src-line"><a name="a667"></a>&nbsp;&nbsp;<span class="src-var">$merge&nbsp;</span>=&nbsp;<span class="src-str">&quot;&quot;</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a668"></a>&nbsp;&nbsp;<span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$moreId&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$k&nbsp;</span>=&gt;&nbsp;<span class="src-var">$value</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a669"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$value&nbsp;</span>!=&nbsp;<span class="src-var">$pageId</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a670"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$merge&nbsp;</span>.=&nbsp;<span class="src-str">&quot;&nbsp;OR&nbsp;cache_id&nbsp;=&nbsp;'&quot;</span>.<span class="src-var">$value</span>.<span class="src-str">&quot;'&nbsp;&quot;</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a671"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a672"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a673"></a>&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$merge</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a674"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a675"></a><span class="src-php">?&gt;</span></div></li>
</ol>
</div>
        <div class="credit">
		    <hr />
		    Documentation generated on Thu, 30 Sep 2010 18:26:50 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
	      </div>
      </td></tr></table>
    </td>
  </tr>
</table>

</body>
</html>